﻿<Window x:Class="OptionsWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:my="clr-namespace:Finestra"
		xmlns:ext="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended" mc:Ignorable="d" Width="580"
		Height="538" WindowStartupLocation="CenterScreen" Title="Finestra Options"
		Background="{x:Static SystemColors.ControlBrush}" TextOptions.TextFormattingMode="Display" ResizeMode="NoResize"
		Topmost="True">
	<Window.Resources>
		<Style TargetType="ToolTip">
			<Setter Property="MaxWidth" Value="200" />
			<Setter Property="ContentTemplate">
				<Setter.Value>
					<DataTemplate>
						<StackPanel>
							<TextBlock MaxWidth="200" TextWrapping="Wrap" Text="{Binding}" />
						</StackPanel>
					</DataTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<BorderGapMaskConverter x:Key="BorderGapMaskConverter" />
		<Style TargetType="{x:Type GroupBox}">
			<Setter Property="BorderBrush" Value="#D5DFE5" />
			<Setter Property="BorderThickness" Value="1" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type GroupBox}">
						<Grid SnapsToDevicePixels="true">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="6" />
								<ColumnDefinition Width="Auto" />
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="6" />
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto" />
								<RowDefinition Height="Auto" />
								<RowDefinition Height="*" />
								<RowDefinition Height="6" />
							</Grid.RowDefinitions>
							<Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}"
									Background="{TemplateBinding Background}" Grid.ColumnSpan="4" Grid.Column="0"
									CornerRadius="4" Grid.Row="1" Grid.RowSpan="3" />
							<ContentPresenter Grid.ColumnSpan="2" Grid.Column="1" Margin="{TemplateBinding Padding}"
									Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
							<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}"
									Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3">
								<Border.OpacityMask>
									<MultiBinding ConverterParameter="7"
											Converter="{StaticResource BorderGapMaskConverter}">
										<Binding ElementName="Header" Path="ActualWidth" />
										<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
										<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
									</MultiBinding>
								</Border.OpacityMask>
								<Border BorderBrush="{TemplateBinding BorderBrush}"
										BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
									<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}"
											CornerRadius="2" />
								</Border>
							</Border>
							<Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="0" Grid.RowSpan="2">
								<ContentPresenter ContentSource="Header" RecognizesAccessKey="True"
										SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
							</Border>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<TabControl Margin="10">
			<TabItem Header="General">
				<StackPanel Orientation="Vertical" Margin="5">
					<CheckBox Margin="3" Name="chkDeskBack">Use per-desktop wallpaper (may cause slight delay when switching)</CheckBox>
					<CheckBox Margin="3" Name="chkThumbs">
						<FrameworkElement.ToolTip>
							Stores cached copies of what windows look like so that you can see windows on other desktops in the fullscreen overview.
						</FrameworkElement.ToolTip>
						Store thumbnails of windows (slower, but useful)
					</CheckBox>
					<CheckBox Margin="3" Name="chkWinWatch">
						<FrameworkElement.ToolTip>
							Causes newly opened windows to move to the desktop specified by the Program Rules, if applicable.
						</FrameworkElement.ToolTip>
						Automatically move newly opened windows to their proper desktop
					</CheckBox>
					<Separator Margin="5" />
					<CheckBox Margin="3" Name="chkShowSplash">
						<FrameworkElement.ToolTip>
							Displays the Finestra logo on startup, because it's pretty.
						</FrameworkElement.ToolTip>
						Show splash screen on startup
					</CheckBox>
					<CheckBox Margin="3" Name="chkUpdates">Automatically check for updates</CheckBox>
				</StackPanel>
			</TabItem>
			<TabItem Header="Interface">
				<StackPanel Orientation="Vertical" Margin="5">
					<CheckBox Margin="3" Name="chkMultTrayIcons">
						<FrameworkElement.ToolTip>
							Places an icon in the notification area for each desktop. Clicking on the icon switches to that desktop, and right-clicking brings up a menu with useful options.
						</FrameworkElement.ToolTip>
						Show a notification icon for each desktop *
					</CheckBox>
					<CheckBox Margin="3" Name="chkIconToolbar">
						<FrameworkElement.ToolTip>
							Displays a small, moveable toolbar on the screen that has buttons for switching desktops.
						</FrameworkElement.ToolTip>
						Use mini-toolbar *
					</CheckBox>
					<CheckBox Margin="3" Name="chkTaskbar">
						<FrameworkElement.ToolTip>
							Places an icon on the taskbar that allows desktop switching and previewing all desktops. Right-click the icon for a useful jump list.
						</FrameworkElement.ToolTip>
						Use taskbar icon (Windows 7) *
					</CheckBox>
					<GroupBox Header="Mini-overview">
						<StackPanel Orientation="Vertical">
							<StackPanel Orientation="Horizontal">
								<CheckBox Name="chkMiniPrevIcon" VerticalAlignment="Center" Margin="3">Show a mini overview above the notification icon when:</CheckBox>
								<ComboBox VerticalAlignment="Center" SelectedIndex="0" Margin="3" Width="150"
										IsEnabled="{Binding ElementName=chkMiniPrevIcon, Path=IsChecked}"
										Name="cboMiniPrev">
									<ComboBoxItem>Clicking the icon</ComboBoxItem>
									<ComboBoxItem>Mousing over the icon</ComboBoxItem>
								</ComboBox>
							</StackPanel>
							<StackPanel Orientation="Horizontal">
								<TextBlock Margin="3" VerticalAlignment="Center">Mini-overview size:</TextBlock>
								<Slider Name="sldMiniPrevSize" Margin="3" Width="150" TickFrequency="1"
										TickPlacement="TopLeft" Maximum="10" Minimum="1" Value="3"
										IsSnapToTickEnabled="True" />
								<TextBlock Margin="3" VerticalAlignment="Center">1/<Run
											Text="{Binding ElementName=sldMiniPrevSize, Path=Value, StringFormat='0'}" /> of the screen</TextBlock>
							</StackPanel>
						</StackPanel>
					</GroupBox>
					<GroupBox Margin="3">
						<GroupBox.Header>
							<CheckBox Name="chkEdgeSwitchEnable" Margin="3" IsChecked="True">Mouse edge switching</CheckBox>
						</GroupBox.Header>
						<StackPanel Orientation="Vertical"
								IsEnabled="{Binding ElementName=chkEdgeSwitchEnable, Path=IsChecked}">
							<StackPanel Orientation="Horizontal">
								<TextBlock VerticalAlignment="Center" Margin="3">Delay:</TextBlock>
								<Slider Name="sldEdgeSwitchDelay" Width="150" Minimum="0" Maximum="2" Value="0.1"
										TickFrequency="0.1" TickPlacement="TopLeft" VerticalAlignment="Center"
										Margin="3" IsSnapToTickEnabled="True" />
								<TextBlock VerticalAlignment="Center" Margin="3"><Run
											Text="{Binding ElementName=sldEdgeSwitchDelay, Path=Value, StringFormat='0.0'}" /> seconds</TextBlock>
							</StackPanel>
							<CheckBox Margin="3" Name="chkEdgeSwitchMouseWrap">
								<FrameworkElement.ToolTip>
									When you switch desktops at the mouse edge, wrap the mouse cursor to the opposite side of the screen to maintain the virtual space illusion. This can be a bit disconcerting.
								</FrameworkElement.ToolTip>
								Wrap the mouse cursor
							</CheckBox>
						</StackPanel>
					</GroupBox>
					<GroupBox Margin="3">
						<GroupBox.Header>
							<TextBlock Margin="3">Fullscreen overview</TextBlock>
						</GroupBox.Header>
						<StackPanel Orientation="Vertical">
							<StackPanel Orientation="Horizontal">
								<TextBlock Margin="3" VerticalAlignment="Center">Fullscreen overview background color:</TextBlock>
								<ext:ColorPicker Width="50" Margin="3" VerticalAlignment="Center"
										Name="clrOverviewBackground" />
							</StackPanel>
							<StackPanel Orientation="Horizontal">
								<TextBlock Margin="3" VerticalAlignment="Center">Fullscreen overview fade time:</TextBlock>
								<Slider Name="sldPrevWinFade" Margin="3" VerticalAlignment="Center" TickFrequency="0.1"
										Minimum="0.05" Maximum="1" Value="0.4" TickPlacement="TopLeft" Width="150" />
								<TextBlock Margin="3" VerticalAlignment="Center">
							<Run Text="{Binding ElementName=sldPrevWinFade, Path=Value, StringFormat='0.0'}" /> seconds
								</TextBlock>
							</StackPanel>
						</StackPanel>
					</GroupBox>
				</StackPanel>
			</TabItem>
			<TabItem Header="Visuals">
				<StackPanel Orientation="Vertical" Margin="5">
					<GroupBox Margin="3">
						<GroupBox.Header>
							<CheckBox Name="chkAnimWinEnable" Margin="3" IsChecked="True">Animate windows</CheckBox>
						</GroupBox.Header>
						<StackPanel Orientation="Vertical"
								IsEnabled="{Binding ElementName=chkAnimWinEnable, Path=IsChecked}">
							<CheckBox Margin="3" Name="chkAnimWinIn">Animate windows into view</CheckBox>
							<CheckBox Margin="3" Name="chkAnimWinOut">Animate windows out of view</CheckBox>
							<StackPanel Orientation="Horizontal">
								<TextBlock Margin="3" VerticalAlignment="Center">Animation time:</TextBlock>
								<Slider Name="sldAnimWinDelay" Margin="3" Width="150" Minimum="0.1" Maximum="1"
										Value="0.2" TickFrequency="0.1" TickPlacement="TopLeft"
										VerticalAlignment="Center" IsSnapToTickEnabled="True" />
								<TextBlock VerticalAlignment="Center"><Run
											Text="{Binding ElementName=sldAnimWinDelay, Path=Value, StringFormat='0.0'}" /> seconds</TextBlock>
							</StackPanel>
						</StackPanel>
					</GroupBox>
					<GroupBox Margin="3">
						<GroupBox.Header>
							<CheckBox Margin="3" Name="chkSwitchInd">
								<FrameworkElement.ToolTip>
									Show an indicator at the center of the screen whenever you switch desktops.
								</FrameworkElement.ToolTip>
								Show indicator when switching desktops
							</CheckBox>
						</GroupBox.Header>
						<StackPanel Orientation="Vertical"
								IsEnabled="{Binding ElementName=chkSwitchInd, Path=IsChecked}">
							<CheckBox Margin="3" Name="chkIndicCenter">
								<FrameworkElement.ToolTip>
									Position the indicator window in the center of the screen. If not selected, the indicator window will appear in the upper-left.
								</FrameworkElement.ToolTip>
								Center the indicator window on-screen
							</CheckBox>
							<StackPanel Orientation="Horizontal">
								<TextBlock Margin="3" VerticalAlignment="Center">Indicator window size:</TextBlock>
								<Slider Name="sldIndSize" Margin="3" Width="150" TickFrequency="1"
										TickPlacement="TopLeft" Maximum="10" Minimum="1" Value="3"
										IsSnapToTickEnabled="True" />
								<TextBlock Margin="3" VerticalAlignment="Center">1/<Run
											Text="{Binding ElementName=sldIndSize, Path=Value, StringFormat='0'}" /> of the screen</TextBlock>
							</StackPanel>
						</StackPanel>
					</GroupBox>
				</StackPanel>
			</TabItem>
			<TabItem Header="Desktops">
				<StackPanel Orientation="Vertical" Margin="5">
					<StackPanel Orientation="Horizontal">
						<TextBlock Margin="3" VerticalAlignment="Center">Number of Desktops*:</TextBlock>
						<ext:IntegerUpDown Minimum="1" Value="4" Width="100" Margin="3" VerticalAlignment="Center"
								Name="numDesktops" />
					</StackPanel>
					<GroupBox Header="Desktop Names" Margin="5">
						<StackPanel Orientation="Vertical">
							<ListBox Height="200" Margin="3" Name="lstDeskNames" />
							<Grid Name="grdDeskNameEdit" IsEnabled="False">
								<Grid.ColumnDefinitions>
									<ColumnDefinition />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>
								<TextBox Grid.Column="0" Margin="3" Name="txtDeskName" />
								<Button Grid.Column="1" Margin="3" Padding="3" Name="btnDeskName">Set Name</Button>
							</Grid>
						</StackPanel>
					</GroupBox>
				</StackPanel>
			</TabItem>
			<TabItem Header="Hotkeys">
				<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
							<ColumnDefinition />
						</Grid.ColumnDefinitions>
						<StackPanel Grid.Column="0" Orientation="Vertical" Margin="5">
							<my:HotkeyControl Header="Switch desktop" Margin="3" x:Name="hotSwitch" IsNumberKey="True" />
							<my:HotkeyControl Header="Switch desktop with arrow" Margin="3" x:Name="hotArrow"
									HasKey="False" />
							<my:HotkeyControl Header="Send window to desktop" Margin="3" x:Name="hotSend"
									IsNumberKey="True" />
							<my:HotkeyControl Header="Send window to desktop with arrow" Margin="3"
									x:Name="hotArrowSend" HasKey="False" />
						</StackPanel>
						<StackPanel Grid.Column="1" Orientation="Vertical" Margin="5">
							<my:HotkeyControl Header="Show fullscreen overview" Margin="3" x:Name="hotOverview" />
							<my:HotkeyControl Header="Display mini-preview at mouse" Margin="3" x:Name="hotPreview" />
							<my:HotkeyControl Header="Window menu" Margin="3" x:Name="hotWinMenu" />
							<my:HotkeyControl Header="Show all windows" Margin="3" x:Name="hotExpose" />
						</StackPanel>
					</Grid>
				</ScrollViewer>
			</TabItem>
			<TabItem Header="Monitors">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition />
					</Grid.RowDefinitions>
					<RadioButton Grid.Row="0" Margin="3" IsChecked="True" Name="radMonAll">Use all monitors</RadioButton>
					<RadioButton Grid.Row="1" Name="radMonSelected" Margin="3">Use only selected monitors:</RadioButton>
					<ext:CheckListBox Grid.Row="2" IsEnabled="{Binding ElementName=radMonSelected, Path=IsChecked}"
							Margin="3" Name="lstMonitors" />
				</Grid>
			</TabItem>
			<TabItem Header="Program Rules">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition />
						<ColumnDefinition />
					</Grid.ColumnDefinitions>
					<ListBox Name="lstRules" Grid.Row="0" Grid.Column="0" Margin="3" ToolTipService.IsEnabled="False"
							MouseEnter="ShowRulesInfo" MouseLeave="HideRulesInfo">
						<FrameworkElement.ToolTip>
							This is the list of programs with rules applied.
						</FrameworkElement.ToolTip>
					</ListBox>
					<DockPanel Grid.Row="1" Grid.Column="0" LastChildFill="True">
						<Button Name="btnRuleRem" DockPanel.Dock="Left" Margin="3" Padding="5,2"
								ToolTipService.IsEnabled="False" MouseEnter="ShowRulesInfo" MouseLeave="HideRulesInfo">
							<FrameworkElement.ToolTip>
								Removes the rules for the selected application.
							</FrameworkElement.ToolTip>
							Remove
						</Button>
						<Button Name="btnRuleAdd" DockPanel.Dock="Right" Margin="3" Padding="5,2"
								ToolTipService.IsEnabled="False" MouseEnter="ShowRulesInfo" MouseLeave="HideRulesInfo">
							<FrameworkElement.ToolTip>
								Adds an application specified by the name of the EXE without the extension. You can also use the 
								wildcards '*' and '?'. '*' matches any number of characters, and '?' matches a single character.
							</FrameworkElement.ToolTip>
							Add Program
						</Button>
						<TextBox Name="txtRule" Margin="3" ToolTipService.IsEnabled="False" MouseEnter="ShowRulesInfo"
								MouseLeave="HideRulesInfo">
							<FrameworkElement.ToolTip>
								Adds an application specified by the name of the EXE without the extension. You can also use the 
								wildcards '*' and '?'. '*' matches any number of characters, and '?' matches a single character.
							</FrameworkElement.ToolTip>
						</TextBox>
					</DockPanel>
					<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1">
						<GroupBox Header="Program Rules" Grid.RowSpan="2" Margin="3" Name="grpRules">
							<StackPanel Orientation="Vertical">
								<CheckBox Name="chkRuleEnforced" Margin="3" ToolTipService.IsEnabled="False"
										MouseEnter="ShowRulesInfo" MouseLeave="HideRulesInfo">
									<FrameworkElement.ToolTip>
										Forces windows of the selected application to follow the specified desktop movement behaviors.
									</FrameworkElement.ToolTip>
									Enforced desktop behavior
								</CheckBox>
								<StackPanel Orientation="Vertical"
										IsEnabled="{Binding ElementName=chkRuleEnforced, Path=IsChecked}">
									<RadioButton Name="radRuleSticky" Margin="20,3,3,3" IsChecked="True"
											ToolTipService.IsEnabled="False" MouseEnter="ShowRulesInfo"
											MouseLeave="HideRulesInfo">
										<FrameworkElement.ToolTip>
											Causes windows of the selected application to remain on all desktops, unaffected by desktop switching.
										</FrameworkElement.ToolTip>
										Sticky
									</RadioButton>
									<RadioButton Name="radRuleDesktop" Margin="20,3,3,3"
											ToolTipService.IsEnabled="False" MouseEnter="ShowRulesInfo"
											MouseLeave="HideRulesInfo">
										<FrameworkElement.ToolTip>
											Forces windows of the selected application to always appear on the specified desktop. They will not 
											be able to be moved to other desktops, and new windows will be pushed to that desktop.
										</FrameworkElement.ToolTip>
										Should stay on desktop:
									</RadioButton>
									<ComboBox Name="cboRuleDesktop" Margin="40,3,3,3"
											IsEnabled="{Binding ElementName=radRuleDesktop, Path=IsChecked}"
											ToolTipService.IsEnabled="False" MouseEnter="ShowRulesInfo"
											MouseLeave="HideRulesInfo">
										<FrameworkElement.ToolTip>
											Sets the desktop that all windows of the selected application will appear on.
										</FrameworkElement.ToolTip>
									</ComboBox>
								</StackPanel>
								<CheckBox Name="chkRuleMinimize" Margin="3" ToolTipService.IsEnabled="False"
										MouseEnter="ShowRulesInfo" MouseLeave="HideRulesInfo">
									<FrameworkElement.ToolTip>
										If an application seems to be naughty when switching desktops, this option causes Finestra to minimize it before trying to hide it.
									</FrameworkElement.ToolTip>
									Should minimize before hiding
								</CheckBox>
							</StackPanel>
						</GroupBox>
						<TextBlock Name="lblRuleHelp" TextWrapping="Wrap" Margin="3">
							Hover over an option for more information.
						</TextBlock>
					</StackPanel>
				</Grid>
			</TabItem>
			<TabItem Header="Plugins">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<ext:CheckListBox Grid.Row="0" IsEnabled="False" Margin="3" Name="lstPlugins" />
					<TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="3">
						This tab is currently for debugging purposes only.
					</TextBlock>
				</Grid>
			</TabItem>
		</TabControl>
		<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Left">
			<Button IsDefault="True" Padding="10,2" MinWidth="70" Margin="10,0,10,10" Name="btnOk">OK</Button>
			<Button Grid.Row="1" HorizontalAlignment="Left" Padding="10,2" MinWidth="70" Margin="10,0,10,10"
					Name="btnDonate">Donate</Button>
		</StackPanel>
		<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
			<Button Padding="10,2" MinWidth="70" Margin="10,0,10,10" Name="btnReset">Reset to Defaults</Button>
			<Button IsCancel="True" Padding="10,2" MinWidth="70" Margin="10,0,10,10" Name="btnCancel">Cancel</Button>
		</StackPanel>
	</Grid>
</Window>
